<?php

namespace App\Kuafu\Sys\Validate;

use App\Kuafu\Base\Enum\BaseCodeEnum;
use App\Kuafu\Base\Validate\BaseValidate;

class MenusValidate extends BaseValidate
{
    public static function addMenus($data)
    {
        $rules = [
            'name'     => 'required|min:1',
            'url'      => 'required|min:1',
            'parentId' => 'required|integer|min:1',
            'type'     => 'required|integer|min:1',
        ];

        $messages = [
            'name.required' => BaseCodeEnum::CODE_TEXT[BaseCodeEnum::ERR_SYSTEM_MENUS_PARAM_NAME],
            'name.min'      => BaseCodeEnum::CODE_TEXT[BaseCodeEnum::ERR_SYSTEM_MENUS_PARAM_NAME],

            'url.required'      => BaseCodeEnum::CODE_TEXT[BaseCodeEnum::ERR_SYSTEM_MENUS_PARAM_URL],
            'parentId.required' => BaseCodeEnum::CODE_TEXT[BaseCodeEnum::ERR_SYSTEM_MENUS_PARAM_PARENT_ID],
            'type.required'     => BaseCodeEnum::CODE_TEXT[BaseCodeEnum::ERR_SYSTEM_MENUS_PARAM_TYPE],
        ];

        return self::validateCheck($data, $rules, $messages);
    }
}
